package com.rainng.coursesystem.task;


import com.rainng.coursesystem.module.task.service.BatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@EnableScheduling
public class BatchScheTask {

    @Autowired
    BatchService service;

    @Scheduled(cron="0 10 0 * * ?")
    public void startTask(){
        service.insertBatchData();
        System.out.println("每天凌晨执行批号更新任务：" + new Date());
    }
}

